<template>
  <div class="deleteDialog" v-if="visible">
    <el-dialog :visible="visible" width="900px" :show-close="false">
      <div slot="title">
        <p>{{ title }}</p>
        <i class="icon el-icon-circle-close" @click="close"></i>
      </div>
      <div class="content">
        <i class="iconfont icon-jinggao"></i>
        <span>确定要删除该派发吗?</span>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" type="primary" @click="handleClick('comfirm')">保 存</el-button>
        <el-button size="small" @click="handleClick('cancle')">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'deleteDialog',
  props: {
    visible: Boolean,
    title: {
      type: String,
      default: '提示'
    }
  },
  methods: {
    handleClick (eventName) {
      if (eventName === 'cancle') {
        this.$emit('update:visible', false)
      }
      this.$emit(eventName)
    },
    close () {
      this.$emit('update:visible', false)
    }
  }
}
</script>

<style scoped lang="less">
.deleteDialog {
  /deep/ .el-dialog__header {
    background-color: #000;
    color: #fff;
    text-align: center;
    position: relative;
    font-weight: bold;
    height: 52px;
    .icon {
      font-size: 20px;
      position: absolute;
      top: 20px;
      right: 20px;
    }
  }
  /deep/ .dialog-footer {
    margin: 0 auto;
    text-align: center;
  }
  .el-button + .el-button {
    margin-left: 200px;
  }
  .content {
    text-align: center;
    height: 50px;
    .iconfont {
      font-size: 50px;
      color: red;
      vertical-align: middle;
    }
    span {
      font-size: 16px;
      margin-left: 20px;
    }
  }
}
</style>
